<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>对象</title>
		<script>
			class Animal{
				constructor(d,a){
					this.name=d;
					this.age=a;
				}
				show(){
					alert("这个动物叫"+this.name+",年龄是"+this.age);
				}
			}
			class Dog extends Animal{
				constructor(d,a,type){
					super(d,a);
					this.type=type;
				}
				show(){
					super.show();
					alert("这个狗的品种是:"+this.type);
				}
			}
			Dog.prototype.legs=4;//属性
			Dog.prototype.bite=function(p){
				alert(this.name+"咬了"+p);
			}
			//var an=new Animal("翠花",4);
			//an.show();
			var dog=new Dog("哮天犬","一万岁","中华土狗");
			dog.show();
			dog.bite("吕洞宾");
			alert(dog.legs);
		</script>
	</head>
	<body>
	</body>
</html>